﻿<%@ WebHandler Language="C#" Class="AjaxComputeCompute" %>

using System;
using System.Collections;
using System.Collections.Generic;
using System.Web;

using monadsphere.ashx;
using monadsphere.js;
using monadsphere.dom;
using monadsphere.dom.events;
using monadsphere.dom.html2;
using monadsphere.demo.compute;

/// <summary>
/// This class demonstrate how components can be created based on JSVar
/// </summary>
public class AjaxComputeCompute: JSHandler {

    public override void process(HttpContext context, Hashtable data) {
        HTMLDocument doc = new HTMLDocument();

        double input1 = (double) data["input1"];
        double input2 = (double) data["input2"];

        ComputeComponent com = doc.getElementById<ComputeComponent>("compute-component");
        HTMLDivElement result = com.getProperty<HTMLDivElement>("result");
        result.textContent = new JSNumber(input1 * input2);
    }
}
